package com.itcrowd.ittao.service.data;

public class ProductStatus {
	private int mCurrentNumber;
	private int mTotalNumber;
	
	public ProductStatus(int totalNumber) {
		mCurrentNumber = 0;
		mTotalNumber = totalNumber;
		if(totalNumber < 0) {
			throw new IllegalStateException("total purchase number should not less than 0!");
		}
	}
	
	void add(int number) {
		mCurrentNumber += number;
	}
	
	void remove(int number) {
		mCurrentNumber -= number;
		if(mCurrentNumber < 0) {
			throw new IllegalStateException("purchase number should not less than 0!");
		}
	}
	
	public int getCurrentNumber() {
		return mCurrentNumber;
	}
	
	public int getTotalNumber() {
		return mTotalNumber;
	}
	
	public String toString() {
		return mCurrentNumber+"/"+mTotalNumber;
	}
}
